import { getChannelsApi, channelsItemType } from "@/apis/channels";
import { useEffect, useState } from "react";
function useHome() {
  const [channels, setChannels] = useState<channelsItemType[]>([]);
  useEffect(() => {
    const fetchData = async () => {
      try {
        const res = await getChannelsApi();
        setChannels(res.data.data.channels);
      } catch (error) {
        throw new Error(`Error fetching data ${error}`);
      }
    };
    fetchData();
  }, []);
  return { channels };
}
export default useHome;
